public class LeetCode1732 {
    public static void main(String[] args) {

    }

    public static int largestAltitude(int[] gain) {
        int max = 0;
        int num = 0;
        for (int item : gain){
            num += item;
            max = Math.max(max, num);
        }

        return max;
    }
}
